package cn.ctodb.wxmp.service.mapper;

import cn.ctodb.wxmp.domain.*;
import cn.ctodb.wxmp.service.dto.MpDTO;

import org.mapstruct.*;
import java.util.List;

/**
 * Mapper for the entity Mp and its DTO MpDTO.
 */
@Mapper(componentModel = "spring", uses = {})
public interface MpMapper {

    @Mapping(source = "menu.id", target = "menuId")
    MpDTO mpToMpDTO(Mp mp);

    List<MpDTO> mpsToMpDTOs(List<Mp> mps);

    @Mapping(source = "menuId", target = "menu")
    Mp mpDTOToMp(MpDTO mpDTO);

    List<Mp> mpDTOsToMps(List<MpDTO> mpDTOs);

    default Menu menuFromId(Long id) {
        if (id == null) {
            return null;
        }
        Menu menu = new Menu();
        menu.setId(id);
        return menu;
    }
}
